package com.ecoolex.ying.space.entity;

import com.ecoolex.framework.common.annotation.Description;
import java.util.ArrayList;
import java.util.Arrays;
import org.springframework.lang.NonNull;

/**
 *
 *   设计师项目条目<br>
 *<br>
 * 数据表： designer_project_items
 *
 */
@Description({"设计师项目条目"})
public class DesignerProjectItemsWithBLOBs extends DesignerProjectItems {
    /**
     *
     *   内容    <br>
     *<br>
     * 字段名： designer_project_items.Content
     */
    @Description({"内容", "数据长度: 65535"})
    private String content;

    /**
     *
     *   图片资源    <br>
     *<br>
     * 字段名： designer_project_items.ImageResources
     */
    @Description({"图片资源", "数据长度: 65535"})
    private String imageResources;

    /**
     * 获取参数<br><br>
     *
     *   内容    <br>
     *<br>
     * 字段名： designer_project_items.Content
     */
    public String getContent() {
        return content;
    }

    /**
     * 设置参数<br><br>
     *
     *   内容<br>
     *<br>
     * 字段名： designer_project_items.Content
     */
    public void setContent(String content) {
        this.content = content == null ? null : content.trim();
    }

    /**
     * 获取参数<br><br>
     *
     *   图片资源    <br>
     *<br>
     * 字段名： designer_project_items.ImageResources
     */
    public String getImageResources() {
        return imageResources;
    }

    /**
     * 设置参数<br><br>
     *
     *   图片资源<br>
     *<br>
     * 字段名： designer_project_items.ImageResources
     */
    public void setImageResources(String imageResources) {
        this.imageResources = imageResources == null ? null : imageResources.trim();
    }

    public enum Column {
        itemsId("ItemsId", "itemsId", "INTEGER", false),
        userId("UserId", "userId", "INTEGER", false),
        projectId("ProjectId", "projectId", "INTEGER", false),
        name("Name", "name", "VARCHAR", true),
        positionDescr("PositionDescr", "positionDescr", "VARCHAR", false),
        sorting("Sorting", "sorting", "INTEGER", false),
        deleted("Deleted", "deleted", "BIT", false),
        createUser("CreateUser", "createUser", "VARCHAR", true),
        createTime("CreateTime", "createTime", "TIMESTAMP", false),
        updateUser("UpdateUser", "updateUser", "VARCHAR", false),
        updateTime("UpdateTime", "updateTime", "TIMESTAMP", false),
        content("Content", "content", "LONGVARCHAR", false),
        imageResources("ImageResources", "imageResources", "LONGVARCHAR", false);

        private static final String BEGINNING_DELIMITER = "`";

        private static final String ENDING_DELIMITER = "`";

        private final String column;

        private final boolean isColumnNameDelimited;

        private final String javaProperty;

        private final String jdbcType;

        public String value() {
            return this.column;
        }

        public String getValue() {
            return this.column;
        }

        public String getJavaProperty() {
            return this.javaProperty;
        }

        public String getJdbcType() {
            return this.jdbcType;
        }

        Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
            this.column = column;
            this.javaProperty = javaProperty;
            this.jdbcType = jdbcType;
            this.isColumnNameDelimited = isColumnNameDelimited;
        }

        public String desc() {
            return this.getEscapedColumnName() + " DESC";
        }

        public String asc() {
            return this.getEscapedColumnName() + " ASC";
        }

        public static Column[] excludes(Column ... excludes) {
            ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
            if (excludes != null && excludes.length > 0) {
                columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
            }
            return columns.toArray(new Column[]{});
        }

        public String getEscapedColumnName() {
            if (this.isColumnNameDelimited) {
                return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
            } else {
                return this.column;
            }
        }
    }
}